package com.qf.smsplatform.pojo;

import com.qf.smsplatform.utils.CheckPhone;
import org.springframework.util.ObjectUtils;

/*2021/10/25*/public class TBlackList implements CheckNull{
    private Long id;
    private String mobile;
    private Long owntype;
    private Long creater;

    private TAdminUser tAdminUser;

    public TAdminUser gettAdminUser() {
        return tAdminUser;
    }

    public void settAdminUser(TAdminUser tAdminUser) {
        this.tAdminUser = tAdminUser;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Long getOwntype() {
        return owntype;
    }

    public void setOwntype(Long owntype) {
        this.owntype = owntype;
    }

    public Long getCreater() {
        return creater;
    }

    public void setCreater(Long creater) {
        this.creater = creater;
    }

    @Override
    public boolean isNull(CheckType type) {
        //判断传递过来的参数是进行什么类型的操作，从而进行相应的判断
        switch (type){
            case ADD:
               return !CheckPhone.isPhone(mobile);
            case UPDATE:
                return ObjectUtils.isEmpty(id)||!CheckPhone.isPhone(mobile);
            case DELETE:
                return ObjectUtils.isEmpty(id);
        }
        return false;
    }
}
